package com.mxm.mirai.bot;

import com.mxm.mirai.service.BotgroupsService;
import net.mamoe.mirai.Bot;
import net.mamoe.mirai.contact.Group;
import net.mamoe.mirai.message.GroupMessageEvent;
import net.mamoe.mirai.message.data.PokeMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.function.Consumer;

/**
 * 戳一戳
 */
@Component
public class BotPoke implements Consumer<GroupMessageEvent> {
    @Autowired
    BotgroupsService botgroupsService;
    private static BotPoke botPoke;
    @PostConstruct
    public void init(){
        botPoke=this;
        botPoke.botgroupsService = this.botgroupsService;
    }
    @Override
    public void accept(GroupMessageEvent event) {
        if("0".equals(botPoke.botgroupsService.QueryBotGroupsState(String.valueOf(event.getBot().getId()),String.valueOf(event.getGroup().getId()),"Apoke"))){return;}
        Group group = event.getGroup();
        String msg = event.getMessage().contentToString();
        switch(msg){
            case "戳一戳" :
                event.getGroup().sendMessage(new PokeMessage("戳一戳", 1, -1));
                break; //可选
            case "比心" :
                event.getGroup().sendMessage(new PokeMessage("比心", 2, -1));
                break; //可选
            case "点赞" :
                event.getGroup().sendMessage(new PokeMessage("点赞", 3, -1));
                break; //可选
            case "心碎" :
                event.getGroup().sendMessage(new PokeMessage("心碎", 4, -1));
                break; //可选
            case "666" :
                event.getGroup().sendMessage(new PokeMessage("666", 5, -1));
                break; //可选
            case "放大招" :
                event.getGroup().sendMessage(new PokeMessage("放大招", 6, -1));
                break; //可选
            case "宝贝球" :
                event.getGroup().sendMessage(new PokeMessage("宝贝球", 126, 2011));
                break; //可选
            case "玫瑰花" :
                event.getGroup().sendMessage(new PokeMessage("玫瑰花", 126, 2007));
                break; //可选
            case "召唤术" :
                event.getGroup().sendMessage(new PokeMessage("召唤术", 126, 2006));
                break; //可选
            case "让你皮" :
                event.getGroup().sendMessage(new PokeMessage("让你皮", 126, 2009));
                break; //可选
            case "结印" :
                event.getGroup().sendMessage(new PokeMessage("结印", 126, 2005));
                break; //可选
            case "手雷" :
                event.getGroup().sendMessage(new PokeMessage("手雷", 126, 2004));
                break; //可选
            case "勾引" :
                event.getGroup().sendMessage(new PokeMessage("勾引", 126, 2003));
                break; //可选
            case "抓一下" :
                event.getGroup().sendMessage(new PokeMessage("抓一下", 126, 2001));
                break; //可选
            case "碎屏" :
                event.getGroup().sendMessage(new PokeMessage("碎屏", 126, 2002));
                break; //可选
            case "敲门" :
                event.getGroup().sendMessage(new PokeMessage("敲门", 126, 2002));
                break; //可选
            //你可以有任意数量的case语句
            default : //可选
                //语句
        }

    }
}
